#include<iostream>
using namespace std;
const int N = 1e5 + 10;
bool f[110][N];
int w[110];
int n;
int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}
int main()
{
	cin >> n;
	int d = 0;
	for (int i = 1; i <= n; i++) {
		cin >> w[i];
		d = gcd(d, w[i]);
	}
	if (d != 1) {
		cout << "INF" << endl;
		return 0;
	}
	f[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < N; j++) {
			f[i][j] = f[i - 1][j];
			if (j >= w[i]) {
				f[i][j] |= f[i][j - w[i]];
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= 10000; i++) {
		if (!f[n][i]) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}